﻿package {	import flash.display.MovieClip;	import flash.events.*;	public class Paddle  extends MovieClip implements IPaddle{		private var xDest:Number;		private var easing:int = 7;		private var targetX:Number;		private var ypos:Number;		public var ball:MovieClip;		private var player:MovieClip;		public function Paddle (ypos:Number, paddle:MovieClip) {			addEventListener (Event.ADDED_TO_STAGE, init);			this.y = ypos;			//b = ball;			player = paddle;		}		public function init (evt:Event):void {			removeEventListener (Event.ADDED_TO_STAGE, init);			player.addEventListener (Event.ENTER_FRAME, movePaddle);		}		public function movePaddle (evt:Event):void {			if (stage.mouseX <= this.width/2) {				targetX = 0;			} else if ( stage.mouseX >= stage.stageWidth -  this.width / 2) {				targetX = stage.stageWidth-this.width;			} else {				targetX = stage.mouseX-this.width/2;			}			this.x += (targetX - this.x) / easing;		}			}}